<template>
<slot :controller="controller" :store="store" :model="model">
    <AppBasisViewLayout :class="classNames" :openType="openType">
        <template #default>
            <slot name="extendActionTimeline" :controller="controller" :store="store" :appEntityCodeName="appDeCodeName">
                <AppExtendActionTimeline 
                    :appEntityCodeName="appDeCodeName"
                    :context="store.context"
                    :viewParams="store.viewParams"
                    :pLoadingHelper="store.loadingHelper"
                    />
            </slot>
        </template>
    </AppBasisViewLayout>
</slot>
</template>
<script lang="ts" setup>
// 基于template/src/views/{{appModules}}/{{pages@APPWFSTEPTRACEVIEW}}/{{spinalCase page.codeName}}-base.vue.hbs生成
import { AppBasisViewLayout } from "@components/layout/basis-view-layout";
import { useProps, useBasic, useAction, useController } from './app-wf-step-trace-view-hook';
import { IEvent, WFStepTraceViewActionType, IWFStepTraceViewAbility, IWFStepTraceViewStore, IParam } from '@/core';

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { 
    model,
    getClassNames, 
    useNavParamsBind,
	useEventBind,
    handleQuickSearch,
  	handleToolbarItemClick,
    handleComponentAction,
	handleCtrlAction,
	handleCtrlInit,
	handleCtrlDestroy
} = useBasic(props);

const emit = defineEmits<{
    (event: 'view-action', name: string, action: WFStepTraceViewActionType, data: IParam[]): void;
    (event: 'view-init', name: string, data: IWFStepTraceViewAbility): void;
    (event: 'view-mounted', name: string, data: IParam): void;
    (event: 'view-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
const classNames = computed(() => {
  	return getClassNames(props);
});

// 初始化控制器
const controller = useController(props, evt);

useNavParamsBind(controller, props);

const store: IWFStepTraceViewStore = controller.getStore();

onMounted(() => {
    controller.viewMounted();
})

onUnmounted(() => {
    controller.viewDestroy();
})
</script>
